<?php
class stFacebookCouponStatistics_model extends stmodel_2_1{

    public function __construct($config) {
        parent::__construct ( $config );
        $this->setTableName('st_coupon_templates');
        $this->setPrimaryKey('CouponID');
    }
    public function get_coupon($id){
        global $wpdb,$current_user;
        return $wpdb->get_var("SELECT COUNT(*) FROM st_coupons WHERE CouponTemplateID = ".$id);
    }
    public function get_sales($id){
        global $wpdb,$current_user;
        return $wpdb->get_var("SELECT COUNT(*) FROM st_coupon_sales WHERE CouponCode IN (SELECT CouponCode FROM st_coupons WHERE CouponTemplateID= ".$id.")");
    }
    

    


}